/**
 * Created by hxpeng on 2017/3/24.
 */

'use strict';

    angular.module('App',[
        'ngAnimate',
        'angular-storage',
        'ngResource',
        'templates',
        'ui.router',
        'ionic',
        'ngTextTruncate',
        'App.common',
        'App.pages'
    ])
        .config(commonConfig)
        .constant('API',"http://www.hxpeng.com/kinder")
        //.constant('API',"http://192.168.1.204/kinder")
        .constant('Global', {
            default_avatarPath:'http://www.hxpeng.com/wechat/assets/img/default_head.png',
            path:{
                wechat_path: "http://www.hxpeng.com/wechat",
                img_path: "http://www.hxpeng.com/images/",
                server_wechat_test_path: "http://www.hxpeng.com/kinder/wechat/testPath",
                server_sdk_auth_path: "http://www.hxpeng.com/kinder/wechat/wechatSdkAuth"
            },
            memberType: [
                {
                    key:"teacher",
                    value:"教师"
                },
                {
                    key:"parent",
                    value:"家长"
                },
                {
                    key:"student",
                    value:"学生"
                }
            ],
            //过滤路径
            filterPath: [
                "/pageNotFound",
                "/bind/menu",
                "/bind/createParent",
                "/bind/bindTeacherInfo",
                "/bind/bindConfirm",
                "/bind/bindResult"
            ]
        })


    /**
     * 全局插件基础设置
     * @param $ionicConfigProvider
     * @param $locationProvider
     */
    function commonConfig($ionicConfigProvider, $urlRouterProvider, $locationProvider, storeProvider,$compileProvider){


        //storage 设置为会话级别，关闭浏览器即过期
        // Store defaults to localStorage but we can set sessionStorage or cookieStorage.
        storeProvider.setStore('sessionStorage');
        //其中 weixin 是微信安卓版的 localId 的形式，wxlocalresource 是 iOS 版本的 localId 形式
        $compileProvider.imgSrcSanitizationWhitelist(/^\s*(http|https|data|weixin|wxLocalresource|wxlocalresource):/);

        //ionic 不缓存页面
        //$ionicConfigProvider.views.maxCache(0);
        $ionicConfigProvider.views.transition('none');
        //$ionicConfigProvider.platform.ios.views.transition('ios');
        //$ionicConfigProvider.platform.android.views.transition('android');
        $ionicConfigProvider.platform.ios.navBar.alignTitle('center');
        $ionicConfigProvider.platform.android.navBar.alignTitle('center');
        $ionicConfigProvider.platform.ios.backButton.previousTitleText('').icon('ion-ios-arrow-thin-left');
        $ionicConfigProvider.platform.android.backButton.previousTitleText('').icon('ion-android-arrow-back');

        //取消路径中的#
        $locationProvider.html5Mode(true);
        //$urlRouterProvider.otherwise("/member/bind");
    };





